package com.weibo.basic.alg.alert.common.entity;

import lombok.Data;

@Data
public class JsonReturn<T> {

    private String msg;
    private boolean success;
    private T data;

    private JsonReturn() {

    }

    public static <T> JsonReturn returnSuccess(T data) {
        JsonReturn<T> ret = new JsonReturn<>();
        ret.setSuccess(true);
        ret.setData(data);
        return ret;
    }

    public static <T> JsonReturn returnFailed(String msg) {
        JsonReturn<T> ret = new JsonReturn<>();
        ret.setSuccess(false);
        ret.setMsg(msg);
        return ret;
    }
}
